package io_cobra

import (
	"clean/usecase"
	"clean/usecase/io/pb"
	"fmt"
	"github.com/spf13/cobra"
)

func Hello(app usecase.Input) *cobra.Command {
	var name string
	cmd := &cobra.Command{
		Use:   "hello",
		Short: "hello",
		Long:  `hello`,
		Run: func(cmd *cobra.Command, args []string) {
			out := &pb.Output{}
			app.Hello(pb.Input{
				Msg: &pb.Input_InputHello{
					InputHello: &pb.InputHello{
						Name: name,
					},
				},
			}, out)
			fmt.Println(out.GetOutputHello().Msg)
		},
	}
	cmd.Flags().StringVarP(&name, "name", "n", "", "name arg")
	return cmd

}
